(window["webpackJsonp"] = window["webpackJsonp"] || []).push([
    ["chunk-43ad5942"],
    {
        "0140": function (t, a, e) {
            "use strict";
            e.r(a);

            var s = function () {
                var t = this,
                    a = t.$createElement,
                    e = t._self._c || a;
                return e("div", { staticClass: "ai-analysis-container" }, [
                    // ==============================
                    // Header 区域
                    // ==============================
                    e(
                        "el-card",
                        { staticClass: "header-card" },
                        [
                            e(
                                "div",
                                { staticClass: "header-title", attrs: { slot: "header" }, slot: "header" },
                                [
                                    e("span", [t._v("🎬 基于人工智能的 Top1000条 数据分析与可视化")]),
                                    e(
                                        "el-button",
                                        {
                                            attrs: { type: "primary", size: "small", loading: t.loading },
                                            on: { click: t.fetchAnalysisData },
                                        },
                                        [e("i", { staticClass: "el-icon-refresh" }), t._v(" 刷新数据 ")]
                                    ),
                                ],
                                1
                            ),
                            e("p", { staticClass: "header-subtitle" }, [
                                t._v("智能挖掘电影评分趋势、模型预测表现与数据洞察"),
                            ]),
                        ],
                        1
                    ),

                    // ==============================
                    // 主体部分
                    // ==============================
                    e(
                        "div",
                        {
                            directives: [
                                { name: "loading", rawName: "v-loading", value: t.loading, expression: "loading" },
                            ],
                            attrs: { "element-loading-text": "正在分析数据..." },
                        },
                        [
                            // 统计信息
                            e(
                                "el-row",
                                { staticClass: "stats-row", attrs: { gutter: 20 } },
                                t._l(t.statItems, function (a, s) {
                                    return e(
                                        "el-col",
                                        { key: s, attrs: { xs: 24, sm: 12, md: 6 } },
                                        [
                                            e(
                                                "el-card",
                                                { staticClass: "stat-card" },
                                                [
                                                    e("div", { staticClass: "stat-content" }, [
                                                        e("div", { staticClass: "stat-title" }, [t._v(t._s(a.title))]),
                                                        e("div", { staticClass: "stat-value" }, [t._v(t._s(a.value))]),
                                                    ]),
                                                ],
                                                1
                                            ),
                                        ],
                                        1
                                    );
                                }),
                                1
                            ),

                            // ==============================
                            // 图片模式 或 图表模式
                            // ==============================
                            t.analysisImages.length
                                ? e(
                                "el-card",
                                { staticClass: "images-card" },
                                [
                                    e(
                                        "div",
                                        { staticClass: "section-header", attrs: { slot: "header" }, slot: "header" },
                                        [t._v(" Python 数据分析可视化图表 ")]
                                    ),
                                    e(
                                        "el-row",
                                        { attrs: { gutter: 16 } },
                                        t._l(t.analysisImages, function (a, s) {
                                            return e(
                                                "el-col",
                                                { key: s, attrs: { xs: 24, md: 12 } },
                                                [
                                                    e(
                                                        "el-card",
                                                        { staticClass: "image-card" },
                                                        [
                                                            e("div", { attrs: { slot: "header" }, slot: "header" }, [
                                                                t._v(t._s(a.title)),
                                                            ]),
                                                            e("div", { staticClass: "image-wrapper" }, [
                                                                e("img", {
                                                                    attrs: { src: a.url, alt: a.title },
                                                                    on: { error: t.handleImageError },
                                                                }),
                                                            ]),
                                                        ],
                                                        1
                                                    ),
                                                ],
                                                1
                                            );
                                        }),
                                        1
                                    ),
                                ],
                                1
                                )
                                : [
                                    // 图表展示模式
                                    e("div", { staticClass: "section-title" }, [t._v("📊 数据可视化分析")]),

                                    // 第一行：评分分布 + 年份趋势
                                    e("div", { staticClass: "chart-row two-cols" }, [
                                        e("div", { staticClass: "chart-item" }, [
                                            e(
                                                "el-card",
                                                { staticClass: "chart-card" },
                                                [
                                                    e("div", { attrs: { slot: "header" }, slot: "header" }, [
                                                        t._v("豆瓣评分分布"),
                                                    ]),
                                                    e("div", { ref: "ratingDistChart", staticClass: "chart-container" }),
                                                ],
                                                1
                                            ),
                                        ]),
                                        e("div", { staticClass: "chart-item" }, [
                                            e(
                                                "el-card",
                                                { staticClass: "chart-card" },
                                                [
                                                    e("div", { attrs: { slot: "header" }, slot: "header" }, [
                                                        t._v("年份与平均评分趋势"),
                                                    ]),
                                                    e("div", { ref: "yearTrendChart", staticClass: "chart-container" }),
                                                ],
                                                1
                                            ),
                                        ]),
                                    ]),

                                    // 第二行：相关性热力图
                                    e("div", { staticClass: "chart-row single-wide" }, [
                                        e(
                                            "el-card",
                                            { staticClass: "chart-card" },
                                            [
                                                e("div", { attrs: { slot: "header" }, slot: "header" }, [
                                                    t._v("特征相关性热力图"),
                                                ]),
                                                e("div", { ref: "correlationChart", staticClass: "chart-container-large" }),
                                            ],
                                            1
                                        ),
                                    ]),

                                    // 第三行：ROC曲线 + 混淆矩阵
                                    e("div", { staticClass: "chart-row two-cols" }, [
                                        e("div", { staticClass: "chart-item" }, [
                                            e(
                                                "el-card",
                                                { staticClass: "chart-card" },
                                                [
                                                    e("div", { attrs: { slot: "header" }, slot: "header" }, [
                                                        t._v("模型 ROC 曲线对比"),
                                                    ]),
                                                    e("div", { ref: "rocCurveChart", staticClass: "chart-container" }),
                                                ],
                                                1
                                            ),
                                        ]),
                                        e("div", { staticClass: "chart-item" }, [
                                            e(
                                                "el-card",
                                                { staticClass: "chart-card" },
                                                [
                                                    e("div", { attrs: { slot: "header" }, slot: "header" }, [
                                                        t._v("最佳模型混淆矩阵 - " + t._s(t.modelResults.bestModel)),
                                                    ]),
                                                    e("div", { ref: "confusionMatrixChart", staticClass: "chart-container" }),
                                                ],
                                                1
                                            ),
                                        ]),
                                    ]),
                                ],

                            // ==============================
                            // 模型结果表格
                            // ==============================
                            e(
                                "el-card",
                                { staticClass: "model-results-card" },
                                [
                                    e(
                                        "div",
                                        { staticClass: "section-header", attrs: { slot: "header" }, slot: "header" },
                                        [t._v(" 🤖 机器学习模型性能对比 ")]
                                    ),
                                    e(
                                        "el-table",
                                        { attrs: { data: t.modelResults.results, border: "", stripe: "" } },
                                        [
                                            e("el-table-column", { attrs: { prop: "model", label: "模型名称", width: "200" } }),
                                            e("el-table-column", {
                                                attrs: { prop: "accuracy", label: "准确率", width: "120" },
                                                scopedSlots: t._u([
                                                    {
                                                        key: "default",
                                                        fn: function (a) {
                                                            return [t._v(" " + t._s((100 * a.row.accuracy).toFixed(2)) + "% ")];
                                                        },
                                                    },
                                                ]),
                                            }),
                                            e("el-table-column", {
                                                attrs: { prop: "f1", label: "F1分数", width: "120" },
                                                scopedSlots: t._u([
                                                    {
                                                        key: "default",
                                                        fn: function (a) {
                                                            return [t._v(" " + t._s(a.row.f1.toFixed(3)) + " ")];
                                                        },
                                                    },
                                                ]),
                                            }),
                                            e("el-table-column", {
                                                attrs: { prop: "rocAuc", label: "ROC AUC", width: "120" },
                                                scopedSlots: t._u([
                                                    {
                                                        key: "default",
                                                        fn: function (a) {
                                                            return [t._v(" " + t._s(a.row.rocAuc.toFixed(3)) + " ")];
                                                        },
                                                    },
                                                ]),
                                            }),
                                            e("el-table-column", { attrs: { prop: "tn", label: "TN", width: "80" } }),
                                            e("el-table-column", { attrs: { prop: "fp", label: "FP", width: "80" } }),
                                            e("el-table-column", { attrs: { prop: "fn", label: "FN", width: "80" } }),
                                            e("el-table-column", { attrs: { prop: "tp", label: "TP", width: "80" } }),
                                            e("el-table-column", {
                                                attrs: { label: "状态", width: "100" },
                                                scopedSlots: t._u([
                                                    {
                                                        key: "default",
                                                        fn: function (a) {
                                                            return [
                                                                e(
                                                                    "el-tag",
                                                                    { attrs: { type: a.row.rocAuc >= 0.9 ? "success" : "info" } },
                                                                    [t._v(" " + t._s(a.row.rocAuc >= 0.9 ? "优秀" : "良好") + " ")]
                                                                ),
                                                            ];
                                                        },
                                                    },
                                                ]),
                                            }),
                                        ],
                                        1
                                    ),
                                ],
                                1
                            ),
                        ],
                        2
                    ),
                ]);
            };

            // ==============================
            // 后端接口定义
            // ==============================
            var l = e("b775");
            var n = {
                getAIAnalysis: function () {
                    return Object(l["a"])("/api/admin/analysis/ai-analysis");
                },
            };

            // ==============================
            // 组件主体逻辑
            // ==============================
            var o = {
                name: "AIAnalysis",
                data: function () {
                    return {
                        loading: !1,
                        movieStats: { totalCount: 0, avgRating: 0, highRatingCount: 0 },
                        modelResults: { bestModel: "-", results: [] },
                        chartInstances: {},
                        analysisImages: [],
                    };
                },
                computed: {
                    statItems: function () {
                        return [
                            { title: "总电影数", value: this.movieStats.totalCount },
                            { title: "平均评分", value: this.movieStats.avgRating },
                            { title: "高评分电影", value: this.movieStats.highRatingCount },
                            { title: "最佳模型", value: this.modelResults.bestModel },
                        ];
                    },
                },
                mounted: function () {
                    this.fetchAnalysisData();
                },
                beforeDestroy: function () {
                    this.destroyAllCharts();
                },
                methods: {
                    // 获取AI分析结果
                    fetchAnalysisData: function () {
                        var t = this;
                        return Object(e("1da1")["a"])(
                            regeneratorRuntime.mark(function a() {
                                var e, s;
                                return regeneratorRuntime.wrap(
                                    function (a) {
                                        while (1)
                                            switch ((a.prev = a.next)) {
                                                case 0:
                                                    return (t.loading = !0), (a.prev = 1), (a.next = 4), n.getAIAnalysis();
                                                case 4:
                                                    (e = a.sent),
                                                        1 === e.code
                                                            ? ((s = e.response),
                                                                (t.movieStats = s.movieStats || t.movieStats),
                                                                (t.modelResults = s.modelResults || t.modelResults),
                                                                t.handleVisualization(s))
                                                            : t.$message.error(e.message || "获取数据失败"),
                                                        (a.next = 12);
                                                    break;
                                                case 8:
                                                    (a.prev = 8),
                                                        (a.t0 = a ),
                                                        console.error(a.t0),
                                                        t.$message.error("数据获取失败，请检查后端服务");
                                                case 12:
                                                    return (a.prev = 12), (t.loading = !1), a.finish(12);
                                                case 15:
                                                case "end":
                                                    return a.stop();
                                            }
                                    },
                                    a,
                                    null,
                                    [[1, 8, 12, 15]]
                                );
                            })
                        )();
                    },

                    // 处理图像/图表可视化
                    handleVisualization: function (t) {
                        var a,
                            e = this;
                        if (null !== (a = t.images) && void 0 !== a && a.length) {
                            this.analysisImages = t.images.map(function (t) {
                                return {
                                    title: t.title,
                                    url: "http://localhost:8000/uploads/ai-analysis/" + t.filename,
                                };
                            });
                            this.destroyAllCharts();
                        } else {
                            this.analysisImages = [];
                            this.$nextTick(function () {
                                e.drawRatingDistribution(t.ratingDistribution);
                                e.drawYearTrend(t.yearTrend);
                                e.drawCorrelationHeatmap(t.correlationMatrix);
                                e.drawROCCurve(t.rocCurves);
                                e.drawConfusionMatrix(t.confusionMatrix);
                            });
                        }
                    },

                    destroyAllCharts: function () {
                        Object.values(this.chartInstances).forEach(function (t) {
                            var a;
                            return null === t || void 0 === t || null === (a = t.dispose) || void 0 === a
                                ? void 0
                                : a.call(t);
                        });
                        this.chartInstances = {};
                    },

                    handleImageError: function (t) {
                        console.error("图片加载失败:", t.target.src);
                        this.$message.warning("部分图片加载失败");
                    },

                    drawRatingDistribution: function () {},
                    drawYearTrend: function () {},
                    drawCorrelationHeatmap: function () {},
                    drawROCCurve: function () {},
                    drawConfusionMatrix: function () {},
                },
            };

            // ==============================
            // 导出模块
            // ==============================
            var d = e("2877");
            var u = Object(d["a"])(o, s, [], !1, null, "5efa496d", null);
            a["default"] = u.exports;
        },
    },
]);
